package cn.ustb.dao;

import cn.ustb.entity.CourseSchedule;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface CourseScheduleDao {
    @Select("select * from courseschedule")
    List<CourseSchedule> getAll();

    @Select("select * from courseschedule where studentid = #{studentId}")
    CourseSchedule get(String studentId);

    @Insert("insert into courseschedule values(#{yearTerm},#{studentId},#{week},#{weekDay},#{joint},#{course},#{teacher},#{classPlace})")
    void insert(CourseSchedule courseSchedule);

    @Update("update courseschedule set week = #{week}, weekday = #{weekDay}, joint = #{joint}, course = #{course}, teacher = #{teacher}, classplace = #{classPlace} where studentid = #{studentId}")
    void update(CourseSchedule courseSchedule);

    @Delete("delete from courseschedule where studentId = #{studentId}")
    void delete(String studentId);

    @Select("select * from courseschedule where studentid = #{studentId} and yearterm = #{yearTerm} and week = #{week}")
    List<CourseSchedule> getAllWithYearTerm(@Param("studentId") String studentId, @Param("yearTerm") String yearTerm, @Param("week") String week);

    @Select("select * from courseschedule where teacher = #{teacher}")
    List<CourseSchedule> getTeacherAllCourse(@Param("teacher") String teacher);
}
